package com.day18me.Test;

public class Employee2 implements Comparable {
    private String Name;
    private int Age;
    private String Gender;

    public Employee2() {
    }

    public Employee2(String name, int age, String gender) {
        this.Name = name;
        this.Age = age;
        this.Gender = gender;
    }

    public String getName() {
        return Name;
    }

    public void setName(String name) {
        this.Name = name;
    }

    public int getAge() {
        return Age;
    }

    public void setAge(int age) {
        this.Age = age;
    }

    public String getGender() {
        return Gender;
    }

    public void setGender(String gender) {
        this.Gender = gender;
    }

    @Override
    public String toString() {
        return "Employee2{" +
                "name='" + Name + '\'' +
                ", age=" + Age +
                ", gender='" + Gender + '\'' +
                '}';
    }

    @Override
    public int compareTo(Object o) {
        Employee2 emp= null;
        if(this ==o)
            return 0;
            if (o instanceof Employee2)
                emp = (Employee2) o;
                if (this.getAge() < emp.getAge())
                    return -1;
                    if (this.getAge() > emp.getAge())
                        return 1;

                    return 0;
                }
            }


